package br.com.verde.exemploteca.implicitconversion.simplest

object IntTimesString {
  implicit def intTimesStringOperator(n: Int) = new {
    def *(s: String) = {
      def stringNTimes(original: String, s: String, n: Int): String = n match {
        case 1 => s
        case _ => stringNTimes(original, s + original, n - 1)
      }  
      stringNTimes(s, s, n)
    }
  }
  
  def main(args : Array[String]) {
    println(3 * "ha ")
  }
}
